home *** CD-ROM | disk | FTP | other *** search
- /* This file defines certain low level operations and characteristics that
- * are likely to be machine dependent.
- */
-
- #if (MPU8086 || MPU8080 || vax)
- #define LITTLE_ENDIAN /* Low order bytes are first in memory */
- #endif
-
- #ifdef AMIGA
-
- #ifdef AMIGADEVDRV
- #define disable() Forbid() /* doesn't really return a value */
- #define restore(intst) Permit()
-
- #else
-
- #define disable() (0) /* got to return a value */
- #define restore(intst) /* but we're not gonna do anything */
- #endif
-
- #ifdef WINDOWIO
- #ifdef putchar
- #undef putchar
- #endif
- #ifdef fflush
- #undef fflush
- #endif
- #define putchar(c) amigaputchar(c)
- #ifdef LATTICE
- #define fflush(fp) ((fp)==stdout ? amigaflush() : _flsbf(-1, fp))
- #else
- #define fflush(fp) ((fp)==stdout ? amigaflush() : flsh_(fp, -1))
- #endif
- /* this has to be the same as in stdio.h */
- #ifdef LATTICE
- #define index strchr
- #endif
- #endif
- #ifdef LATTICE
- #undef printf
- #endif
- #endif WINDOWIO
- /* These two lines assume that your compiler's longs are 32 bits and
- * shorts are 16 bits. It is already assumed that chars are 8 bits,
- * but it doesn't matter if they're signed or unsigned.
- */
- typedef long int32; /* 32-bit signed integer */
- typedef unsigned short int16; /* 16-bit unsigned integer */
-
- #define bcopy(a,b,cnt) movmem(a,b,cnt)
-
- #ifdef LITTLE_ENDIAN
- int32 ntohl();
- int16 ntohs();
- #else /* Degenerate case for Big Endian machines */
- #define ntohl(x) (x)
- #define ntohs(x) (x)
- #endif
-
- #define min(x,y) ((x)<(y)?(x):(y))
- #define max(x,y) ((x)>(y)?(x):(y))
-
- int16 cksum();
-
- /* Host-to-network and network-to-host are symmetrical */
- #define htonl(x) ntohl(x)
- #define htons(x) ntohs(x)
-
- #ifdef MPU8080 /* Assembler routines are available */
- int16 hinibble(),lonibble(),hibyte(),lobyte(),hiword(),loword();
-
- #else
-
- /* Extract a short from a long */
- #define hiword(x) ((int16)((x) >> 16))
- #define loword(x) ((int16)(x))
-
- /* Extract a byte from a short */
- #define hibyte(x) (((x) >> 8) & 0xff)
- #define lobyte(x) ((x) & 0xff)
-
- /* Extract nibbles from a byte */
- #define hinibble(x) (((x) >> 4) & 0xf)
- #define lonibble(x) ((x) & 0xf)
-
- #endif
-
- /* Define null object pointer in case stdio.h isn't included */
- #ifndef NULL
- /* General purpose NULL pointer */
- #define NULL (void *)0
- #endif
- #define NULLCHAR (char *)NULL /* Null character pointer */
- #define NULLFP (int (*)())0 /* Null pointer to function returning int */
- #define NULLVFP (void (*)())0 /* Null pointer to function returning void */
- #define NULLFILE (FILE *)NULL /* Null file pointer */
-